<template>
  <el-container>
    <el-header height="70px">
      <div class="headerBox">
        <div class="headerLogo">
          <p>漫画世界</p>
          <ul>
            <li
              v-for="(item, index) in headerTopsList"
              :class="index !== 0 ? 'spaceStyle' : ''"
              :key="index"
            >
              {{ item }}
            </li>
          </ul>
        </div>
        <div class="headerUser">
          <div
            class="operationButtonDiv"
            v-for="item in headerTopsoperationButton"
            :key="item.id"
          >
            <div class="imgClass" v-if="item.id == 1 || item.id == 4">
              <img :src="item.url" alt="" />
            </div>
            <div class="imgClass" v-if="item.id == 2 || item.id == 3">
              <i :class="item.url"></i>
            </div>
            <span>{{ item.name }}</span>
          </div>
          <div class="userPhotos">
            <img src="../../assets/images/comic/header/headerUser.gif" alt="" />
          </div>
        </div>
      </div>
    </el-header>
    <el-main><router-view /></el-main>
  </el-container>
</template>
<script>
export default {
  data () {
    return {
      headerTopsList: ['首页', '更新', '排行', '火热'],
      headerTopsoperationButton: [
        { id: '1', name: 'VIP', fild: 'headerVip', url: require('../../assets/images/comic/header/header-vip.png') },
        { id: '2', name: '历史', fild: 'history', url: 'el-icon-time' },
        { id: '3', name: '收藏', fild: 'collection', url: 'el-icon-star-on' },
        { id: '4', name: '礼物', fild: 'gift', url: require('../../assets/images/comic/header/header-lb.png') }
      ]
    };
  },
  created: function () {
    var mainPath = window.sessionStorage.getItem('mainPath');
    if (mainPath === null || mainPath === '') {
      window.sessionStorage.setItem('mainPath', '/homePageNew');
      mainPath = '/homePageNew';
    }
    this.$router.push(mainPath);
  }

};
</script>
<style lang="less" scoped>
.el-container {
  height: 100%;
  width: 100%;
}
.el-header {
  //background-color: red;
  margin: 0px;
  padding: 0px;
  display: flex;
  justify-content: center;
  background-color: #ffffff;
  > .headerBox {
    width: 1200px;
    //background-color: blue;
    height: 100%;
    > .headerLogo {
      float: left;
      height: 100%;
      width: 50%;
      background-color: #ffffff;
      display: flex;
      align-content: center;
      p {
        float: left;
        display: block;
        font-size: 28px;
        height: 100%;
        display: flex;
        align-items: center;
        font-weight: bold;
        color: #a900ff;
      }
      ul {
        margin-left: 15px;
        display: block;
        height: 100%;
        float: left;
        display: flex;
        align-items: center;
        li {
          float: left;
          list-style: none;
          font-size: 18px;
        }
        .spaceStyle {
          margin-left: 20px;
        }
      }
    }
    > .headerUser {
      float: left;
      height: 100%;
      width: 50%;
      //background-color: #;
      display: flex;
      justify-content: flex-end;
      .userPhotos {
        display: flex;
        align-items: center;
        height: 100%;
        width: 40px;
        margin-left: 15px;
        margin-right: 10px;
      }
      .operationButtonDiv {
        height: 100%;
        float: left;
        margin-left: 10px;
        width: 32px;
        .imgClass {
          height: 50%;
          display: flex;
          justify-content: center;
          align-items: flex-end;
          img {
            width: 18px;
            height: 18px;
          }
          i {
            font-size: 20px;
          }
        }
        span {
          display: flex;
          justify-content: center;
          height: 50%;
          font-size: 15px;
        }
      }
    }
  }
}

.el-main {
  margin: 0px;
  padding: 0px;
  height: 100%;
}
</style>
